﻿@model TuanAnhPersonalWeb.Models.TUANANH__ALBUM

@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    
        <table>
        <tr>
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.ALBUM_THUMB)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.ALBUM_THUMB, new { id = "imgdir", @readonly = "true" })
            @Html.ValidationMessageFor(model => model.ALBUM_THUMB)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ALBUM_TITLE)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.ALBUM_TITLE, new { id="title"})
            @Html.ValidationMessageFor(model => model.ALBUM_TITLE)
        </div>

        
        </td>
        <td width="100%">
         <script type="text/javascript">
             var finder = new CKFinder();
             finder.selectActionFunction = ShowFileInfo;
             finder.basePath = '/ckfinder/';
             finder.create();
             config.defaultDisplayFilename = true;
             function ShowFileInfo(fileUrl, data) {
                 //var imgdir = document.getElementById("imgdir").value;
                 document.getElementById("imgdir").value = fileUrl;
                 alert('Add Link Successfully. Please enter description on the left hand side of the screen!.');
             }
                
</script>
        </td>
        </tr>
        </table>
        <p>
            <input type="submit" value="Create" onclick="return change_value();" />
        </p>
    
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript">
   
    function change_value() {
        var dir = document.getElementById("imgdir").value;
        var title = document.getElementById("title").value;
        if (dir==""  || title=="") {
            alert("Không được để trống thông tin");
            return false;
        }
        else
        { return true }


    }
</script>